package com.zwj.spring_study.a01;

import com.zwj.spring_study.a01.entity.User;
import com.zwj.spring_study.a01.event.UserRegisteredEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author 张文接
 * @version 1.0
 * @createTime 2024/5/8 23:15
 */
@Slf4j
@Component
public class Component1 {

    @EventListener
    public void sendMsg(UserRegisteredEvent event) {
        Component2 component2 = (Component2) event.getSource();
        User user = component2.getUser();
        log.info("用户：{}，发送短信：10086", user.getName());
    }
}
